local border_blocks = { 
	{ "goldblock",				"default"},
	{ "diamondblock",		"default" },
	{ "glass",					"default"},
	{ "mithril_block",			"moreores"},
	{ "silver_block",			"moreores" },
	{ "amethystblock",		"glooptest" },
	{ "emeraldblock",			"glooptest" },
	{ "rubyblock",				"glooptest"},
	{ "sapphireblock",		"glooptest" },
	{ "taliniteblock",			"glooptest" },
	{ "topazblock",			"glooptest" },
	{ "crystal_glass",			"glooptest" }
}

for i in ipairs(border_blocks) do
	local block = border_blocks[i][1]
	local mod = border_blocks[i][2]


	if block ~= "goldblock" then

		minetest.register_craft( {
			    output = "gold_and_gem:golden_"..block.." 5",
			    recipe = {
					{"default:gold_ingot", mod .. ":" ..  block, "default:gold_ingot"},
					{ mod .. ":" ..  block, mod .. ":" ..  block, mod .. ":" ..  block},
					{"default:gold_ingot", mod .. ":" ..  block, "default:gold_ingot"},
			    },
		})

	end

	if block ~= "mithril_block" then

		minetest.register_craft( {
			    output = "gold_and_gem:mithril_"..block.." 5",
			    recipe = {
					{"moreores:mithril_ingot", mod .. ":" ..  block, "moreores:mithril_ingot"},
					{ mod .. ":" ..  block, mod .. ":" ..  block, mod .. ":" ..  block},
					{"moreores:mithril_ingot", mod .. ":" ..  block, "moreores:mithril_ingot"},
			    },
		})

	end

end

local glass_tables = { "glass_table_small_round_b", "glass_table_small_square_b", "glass_table_large_b"} 
local table_borders = { 
	{ "gold",				"default:gold_ingot"},
	{ "mithril",				"moreores:mithril_ingot"},
	{ "emerald",			"glooptest:emerald_gem"},
	{ "ruby",				"glooptest:ruby_gem"}

}

for i in ipairs(glass_tables) do
	local table = glass_tables[i]

	for j in ipairs(table_borders) do
		local border = table_borders[j][1]
		local border_item = table_borders[j][2]

		minetest.register_craft( {
				    output = "gold_and_gem:"..border.. "_" ..table.." 3",
				    recipe = {
						{border_item, "", border_item},
						{ "homedecor:" ..table,  "homedecor:" ..table, "homedecor:" ..table},
						{"", "", ""},
				    },
			})
	end
end

local bobblock = { 
	{ "blue",		"moreores",		"mithril_ingot", 		"wool:blue"},
	{ "green",		"glooptest",		"arol_ingot", 			"wool:dark_green"},
	{ "grey",		"default", 		"stone", 				""},
	{ "indigo",		"glooptest", 		"akalin_ingot", 		"wool:magenta"},
	{ "orange",		"glooptest", 		"topaz_gem", 			"wool:orange"},
	{ "red",		"glooptest", 		"ruby_gem", 			"wool: red"},
	{ "violet",		"glooptest",		"alatro_ingot", 		"wool: violet"},
	{ "white",		"default", 		"diamond", 			""},
	{ "yellow",		"default",		"mese_crystal", 		""},
	{ "lime",		"technic",		"uranium_ingot", 		"wool:green"},
	{ "pink",		"glooptest",		"amethyst_gem", 		"wool:pink"},
	{ "cyan",		"glooptest",		"talinite_ingot", 		"wool:cyan"}


}

local light_source = "homedecor:glowlight_small_cube_white"

if not minetest.get_modpath("homedecor") then
	
	light_source = "default:torch"

end

for i in ipairs(bobblock) do
	local block = bobblock[i][1]
	local mod 	 = bobblock[i][2]
	local mod_item 	 = bobblock[i][3]
	local d_item 	 = bobblock[i][4]
	local item = mod ..":".. mod_item
	

	if (mod ~= "default" and not minetest.get_modpath(mod))then
	
		item = d_item

	end


	

	minetest.register_craft({
		output = "gold_and_gem:"..block.."block 2", 
		recipe = {
			{"default:glass", item, "default:obsidian_glass"},
			{ item,light_source,item},
			{"default:obsidian_glass", item, "default:glass"},
		},
	})

	minetest.register_craft({
	type = "shapeless",
		output = "gold_and_gem:"..block.."pole 4", 
		recipe = {
			"gold_and_gem:"..block.."block"
			
		},
	})

end

local gemlamps = {"ruby","amethyst","emerald", "topaz", "sapphire"}

for i in ipairs(gemlamps) do
	local gem = gemlamps[i]
	light_source = "homedecor:candle"

	if not minetest.get_modpath("homedecor") then
	
		light_source = "default:torch"
	end



	minetest.register_craft({
	output = "gold_and_gem:"..gem.."_lamp 2", 
		recipe = {
			{"glooptest:"..gem.."_gem","default:diamond", "glooptest:"..gem.."_gem"},
			{ "technic:marble",light_source,"technic:marble"},
			{"", "moreores:silver_ingot", ""},
		},
	})
end

local pillars = {"gold","silver"}

for i in ipairs(pillars) do
	local pill  = pillars[i]
	minetest.register_craft({
	output = "gold_and_gem:pillar_"..pill.." 6", 
		recipe = {
			{"technic:marble","technic:marble", "technic:marble"},
			{ "technic:fine_"..pill.."_wire","technic:marble","technic:fine_"..pill.."_wire"},
			{"technic:marble", "technic:marble", "technic:marble"},
		},
	})
	minetest.register_craft({
	output = "gold_and_gem:pillar_ground_"..pill.." 2", 
		recipe = {
			{"","gold_and_gem:pillar_"..pill, ""},
			{ "","gold_and_gem:pillar_"..pill,""},
			{"technic:slab_marble_quarter", "technic:slab_marble_quarter", "technic:slab_marble_quarter"},
		},
	})

	minetest.register_craft({
	output = "gold_and_gem:pillar_top_"..pill.." 2", 
		recipe = {
			{"technic:slab_marble_quarter", "technic:slab_marble_quarter", "technic:slab_marble_quarter"},
			{ "","gold_and_gem:pillar_"..pill,""},
			{"","gold_and_gem:pillar_"..pill,""},
		},
	})

end

minetest.register_craft({
output = "gold_and_gem:pillar 6", 
	recipe = {
		{"technic:marble","technic:marble", "technic:marble"},
		{ "technic:marble_bricks","technic:marble","technic:marble_bricks"},
		{"technic:marble", "technic:marble", "technic:marble"},
	},
})
minetest.register_craft({
output = "gold_and_gem:pillar_ground 2", 
	recipe = {
		{"","gold_and_gem:pillar", ""},
		{ "","gold_and_gem:pillar",""},
		{"technic:slab_marble_quarter", "technic:slab_marble_quarter", "technic:slab_marble_quarter"},
	},
})

minetest.register_craft({
output = "gold_and_gem:pillar_top 2", 
	recipe = {
		{"technic:slab_marble_quarter", "technic:slab_marble_quarter", "technic:slab_marble_quarter"},
		{ "","gold_and_gem:pillar",""},
		{"","gold_and_gem:pillar",""},
	},
})




